<% %>
<div class="page_head">
  <h2><%= "Language: %s" / Locale.language.english_name %></h2>
</div>
        <table width=100% class=data>
	   <%form_for :filter,:url=>'/admin/translate/index' do |f|%>
	    <tr>
	      <td colspan=5>Key:<%=f.text_field"english"%> Value:<%=f.text_field"chinese"%><%=submit_tag "Search".t%> <%=submit_tag "Untranslated"%></td>
	    </tr>
	    <%end%>
            <tr>
	      <th>id</th><th width=40%>key</th><th>qty</th><th>translation</th><th>Trash</th>
	    </tr>
            <% @view_translations.each do |tr| %>
            <tr>
	      <td><%= tr.id %></td>
	      <td><%= tr.tr_key %></td>
	      <td><%= tr.pluralization_index %></td>
              <td><span id="tr_<%= tr.id %>">
                 <%= render :partial => 'translation_text', :object => tr.text %>
                 </span>
	      </td>
	      <td align=center><%=link_to image_tag("trash.gif",:border=>0),{:action=>'delete',:id=>tr.id,:page=>params[:page]},:confirm=>'Are you sure?'.t%></td>	
	    </tr>
            <%= in_place_editor "tr_#{tr.id}", :url => { :action => :set_translation_text,:id => tr.id }, :load_text_url => url_for({ :action => :translation_text, :id => tr.id }) %>
            <% end %>

	    <tr><td colspan=5 class="page">
            <%#search_params = Hash[*params[:filter].collect {|k,v| ["search[#{k.to_s}]", v]}.flatten] %> 
            <%search_params = Hash[*{:ch=>@ch,:en=>@en,:un=>@un}.collect{|k,v| [k,v]}.flatten]%> 
                <%if @view_pages.length > 1%> Pages: <%end%>
                <%link_to '<<', "/admin/translate?page=" + @view_pages.current.previous.to_i.to_s if @view_pages.current.previous %> 
                <%=pagination_links @view_pages,:params=>search_params%> 
                <%link_to '>>', "/admin/translate?page=" + @view_pages.current.next.to_i.to_s if @view_pages.current.next%>
	    </td></tr>
        </table>

